﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SES.CMS.BL;
using SES.CMS.DO;

namespace SES.CMS
{
    public partial class Login : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btn_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //code.....


                ClientScriptManager csm = Page.ClientScript;
                string js = "<script language=\"javascript\">window.close();</script>";
                csm.RegisterStartupScript(Page.GetType(), "StatusEndPage", js);
            }
        }

        protected void btnLogin_Click(object sender, EventArgs e)
        {
            string txtPass = Ultility.EncryptMd5(txtPassword.Text);
            ClientLoginDO obj = new ClientLoginBL().SelectLogin(txtUsername.Text, txtPass);
            if (obj.ClientLoginID > 0)
            {
                Session["TenDN"] = txtUsername.Text;
                Session["IDDN"] = obj.ClientLoginID.ToString();
                Session["ClientName"] = obj.ClientName.ToString();
                Ultility.Alert("Bạn đã đăng nhập thành công!!!", "/Default.aspx");
            }
            else
            {
                Ultility.Alert("Đăng nhập thất bại!!!", "Login.aspx");
            }
        }
    }
}
